package com.zadtek.jpsqishi;

import android.os.Bundle;

public class MessageEvents {
    /**
     * 新任务列表 刷新
     */
    public static final String REFRESH_NEW_TASK_LIST = "refresh_new_task_list";
    /**
     * 默认事件
     */
    private String eventsType = "default_events";
    /**
     * 信息传递
     */
    private Bundle message;

    public MessageEvents setEventsType(String eventsType) {
        this.eventsType = eventsType;
        return this;
    }

    public String getEventsType() {
        return eventsType;
    }

    public Bundle getMessage() {
        return message;
    }

    public MessageEvents setMessage(Bundle message) {
        this.message = message;
        return this;
    }

    public MessageEvents setMessage(Object value) {
        this.message = new Bundle();
        if (value instanceof String) {
            message.putString(getEventsType(), (String) value);
        } else if (value instanceof Integer) {
            message.putInt(getEventsType(), (int) value);
        } else if (value instanceof Boolean) {
            message.putBoolean(getEventsType(), (Boolean) value);
        } else {
            message.putString(getEventsType(), String.valueOf(value));
        }
        return this;
    }
}
